package com.situ.java.domain;

import java.io.Serializable;

//        1-进书、办理借书卡
//        2-借书和还书功能
//        3-查询某书的借阅记录
//        4-查询谋卡的借阅记录
//        5-按借阅次数，显示图书信息。
public class Book implements Comparable<Book>, Serializable{
    /** serialVersionUID*/  
    private static final long serialVersionUID = 131351511L;
    
    private int id; //图书ID
    private String name;    //图书名
    private String author;  //图书作者
    private String press;   //出版社
    private int time = 0;       //借阅次数
    private Status status = Status.FREE;

    public Book() { }

    public Book(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public Book(int id, String name, String author) {
        this.id = id;
        this.name = name;
        this.author = author;
    }

    public Book(int id, String name, String author, String press) {
        this.id = id;
        this.name = name;
        this.author = author;
        this.press = press;
    }

    public int getId() { return id; }

    public void setId(int id) { this.id = id; }

    public String getName() { return name; }

    public void setName(String name) { this.name = name; }

    public String getAuthor() { return author; }

    public void setAuthor(String author) { this.author = author; }

    public String getPress() { return press; }

    public void setPress(String press) { this.press = press; }

    public void setTime(int time) { this.time = time; }

    public int getTime() { return time; }

    public Status getStatus() { return status; }

    public void setStatus(Status status) { this.status = status; }

    public String getDetails() {
        return id+"\t"+name+"\t"+author+"\t"+press+"\t"+status+"\t"+time;
    }

    @Override
    public String toString() {
        return getDetails();
    }

    @Override
    public int compareTo(Book o) {
        return this.getTime()>o.getTime()?-1:1;
    }
}
